The present invention relates to the field of memory management and, more particularly, to selectively retaining a topmost subpool expansion to prevent thrashing.
Performance of computing systems that perform dynamic memory allocation can be poor due to a need to continuously allocate and deallocate memory blocks. One way to increase performance is to utilize a subpool of allocated memory. A subpool is a memory region that includes a set of buffers, within which data can be placed. Multiple different subpools can be utilized in a computing system, where each is dedicated to an associated application, thread, or task.
Within each subpool, a buffer replacement scheme (e.g., First-In-First-Out (FIFO), Least Recently Used (LRU), etc) can be established for determining which of the included buffers is to be used to store a new data element. A data element placed in a subpool buffer can be accessed until it expires, which is when it is overwritten by a different data element. When a time a data element is held in a queue is less than a desired time, excessive data swaps in and out of the subpool occur. These data swaps diminish performance and consume system resources.
To improve performance, subpools can be tuned or optimized so that their size and configuration is well suited for the memory needs that are being supported. Tuning a subpool can involve calculating a duration that data elements are retained within the subpool and making adjustments to ensure that a desired retention exists. One way of tuning a subpool is to change a buffer size, which changes a number of data “slots” available in the subpool. Making a buffer size too small can require a data element be placed in multiple buffers, however, since each buffer must be of sufficient size to store a desired data element. When a buffer size is fully tuned or optimized for a situation, but when a time in queue for data elements is still too low, a subpool expansion can be allocated.
Subpool memory systems that enable extents often limit a maximum number of expansions for a subpool to a small number, where these expansions are rapidly released back to available unallocated memory. Releasing a subpool expansion results in all data included in the expansion being removed. When the deallocation occurs before a data handling surge that caused the subpool expansion to be created is handled, the system will be in a state equivalent to that that triggered the subpool expansion to be created. Thus, a new subpool expansion is triggered, which will again be relatively rapidly released. A “thrashing” situation can result, where one or more subpool expansions are continuously allocated and deallocated. Both adding and returning expansions involves a call to system level services, which are costly in terms of CPU cycles.